home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 8 / Eagles_Nest_Mac_Collection_Disc_8.TOAST / Developer Environments / MacCjr / MacC Jr / Library Folder / C Include Folder / OsIO.h < prev    next >
Encoding:
Text File  |  1987-01-06  |  6.4 KB  |  275 lines  |  [TEXT/EDIT]

  1. // OSIO.h
  2. // Mac OS I/O interface
  3. // © Copyright 1984 Consulair Corp, All Rights Reserved.
  4. // Portions © Copyright Apple Computer, Inc: 1982, 1983, 1984
  5. //            Stanford University, SUMEX project: 1984
  6. // Generally use HFSdefs.h since it supports both
  7. // the MFS and HFS file managers and file systems.
  8.  
  9. #ifndef OSioLoaded
  10.  
  11.   #ifndef MacdefsLoaded
  12.     #include "macdefs.h"
  13.     #endif
  14.   
  15. #define OSioLoaded
  16.  
  17. #ifdef HFSdefsLoaded
  18.   #Options E
  19.    ####You cannot include OSIO.h and HFSDefs.h in the same file####
  20.    #endif
  21.  
  22. // file system error codes 
  23.  
  24.     #define    dirFulErr  -33
  25.     #define dskFulErr  -34
  26.     #define    nsvErr     -35
  27.     #define    ioErr      -36
  28.     #define    bdNamErr   -37
  29.     #define    fnOpnErr   -38
  30.     #define    eofErr     -39
  31.     #define    posErr     -40
  32.     #define    mFulErr    -41
  33.     #define    tmfoErr    -42
  34.     #define    fnfErr     -43
  35.     #define    wPrErr     -44
  36.     #define    fLckdErr   -45
  37.     #define    vLckdErr   -46
  38.     #define    fBsyErr    -47
  39.     #define    dupFNErr   -48
  40.     #define    opWrErr    -49
  41.     #define    paramErr   -50
  42.     #define    rfNumErr   -51
  43.     #define    GFPErr     -52
  44.     #define    volOffLinErr -53
  45.     #define    permErr    -54
  46.     #define    volOnLinErr -55
  47.     #define    nsDrvErr   -56
  48.     #define    noMacDskErr -57
  49.     #define    extFSErr   -58
  50.     #define    fsRnErr    -59
  51.     #define    badMDBErr  -60
  52.     #define    wrPermErr  -61
  53.     #define    firstDskErr -84
  54.     #define    lastDskErr -64 
  55.  
  56. // IO queue elements 
  57.   
  58.   #define OsType long
  59.   struct FInfo
  60.     {        // FInfo, finder info 
  61.     OsType    fdType;
  62.     OsType    fdCreator;
  63.     short    fdFlags;
  64.     Point    fdLocation;
  65.     short    fdFldr;
  66.     };
  67.   
  68.   #define FInfo struct FInfo
  69.     
  70.  // Finder attributes
  71.    #define   cfInited       0x0100
  72.    #define   cfHasChanged   0x0200
  73.    #define   cfIsBusy       0x0400
  74.    #define   cfNoCopy       0x0800
  75.    #define   cfSystemFile   0x1000
  76.    #define   cfHasBundle    0x2000
  77.    #define   cfInvisible    0x4000
  78.    #define   cfLocked       0x8000
  79.    
  80.  //  Finder flags
  81.    #define   fTrash        -3
  82.    #define   fDeskTop      -2
  83.    #define   fDisk          0
  84.    
  85.  
  86.  // File System attributes
  87.    #define   fsLocked       0x01
  88.    #define   fsNoCopy       0x40
  89.    #define   fsBusy         0x80
  90.    
  91.    
  92.  // read/write permissions
  93.    #define   fsCurPerm    0
  94.    #define   fsRdPerm     1
  95.    #define   fsWrPerm     2
  96.    #define   fsRdWrPerm   3
  97.    
  98.  // ioPosMode settings
  99.    #define   fsAtMark      0       /* from current - ignore ioPosOffset */
  100.    #define   fsFromStart   1       /* offset from beginning of file */
  101.    #define   fsFromLEOF    2       /* offset from logical end-of-file */
  102.    #define   fsFromMark    3       /* offset from current mark */
  103.      
  104.   struct __IO
  105.     {        // general IO parameter block 
  106.     struct    __IO    *ioLink;
  107.     short    ioType;    
  108.     short    ioTrap;
  109.     Ptr        ioCmdAddr;
  110.     ProcPtr    ioCompletion;
  111.     short    ioResult;
  112.     char    *ioNamePtr;
  113.     short    ioVRefNum;
  114.     short    ioRefNum;
  115.     char    ioVersNum;
  116.     char    ioPermssn;
  117.     Ptr        ioMisc;
  118.     // Rename: new name 
  119.     // GetEOF,SetEOF: logical end of file
  120.     // Open: optional ptr to buffer
  121.     // SetFileType: new type
  122.     Ptr        ioBuffer;
  123.     long    ioReqCount;
  124.     long    ioActCount;
  125.     short    ioPosMode;
  126.     long    ioPosOffset;
  127.     };
  128.     
  129.   #define ioParam struct __IO
  130.   typedef   struct __IO   IOParam;
  131.   
  132.   struct __FP
  133.     {        // get/set fileinfo parameter block 
  134.     struct    __FP *ioLink;
  135.     short    ioType;
  136.     short    ioTrap;
  137.     Ptr        ioCmdAddr;
  138.     ProcPtr    ioCompletion;
  139.     short    ioResult;
  140.     char    *ioNamePtr;
  141.     short    ioVRefNum;
  142.     short    ioFRefNum;
  143.     char    ioFVersNum;
  144.     char    filler1;
  145.     short    ioFDirIndex;
  146.     char    ioFlAttrib;    // in-use bin=7 lock bit=0 
  147.     char    ioFlVersNum;
  148.     FInfo    ioFlFndrInfo;
  149.     long    ioFlNum;
  150.     short    ioFlStBlk;
  151.     long    ioFlLgLen;
  152.     long    ioFlPyLen;
  153.     short    ioFlRStBlk;
  154.     long    ioFlRLgLen;
  155.     long    ioFlRPyLen;
  156.     long    ioFlCrDat;
  157.     long    ioFlMdDat;
  158.     };
  159.     
  160.   #define FileParam struct __FP
  161.   
  162.   struct __VP
  163.     {        // get/set volumeinfo parameter block 
  164.     struct    __VP *ioLink;
  165.     short    ioType;
  166.     short    ioTrap;
  167.     Ptr        ioCmdAddr;
  168.     ProcPtr    ioCompletion;
  169.     short    ioResult;
  170.     char    *ioNamePtr;
  171.     short    ioVRefNum;
  172.     long    filler2;
  173.     short    ioVolIndex;
  174.     long    ioVCrDate;
  175.     long    ioVLsBkUp;
  176.     short    ioVAtrb;
  177.     short    ioVNmFls;
  178.     short    ioVDirSt;
  179.     short    ioVBlLn;
  180.     short    ioVNmAlBlks;
  181.     long    ioVAlBLkSiz;
  182.     long    ioVClpSiz;
  183.     short    ioAlBlSt;
  184.     long    ioVNxtFNum;
  185.     short    ioVFrBlk;
  186.     };
  187.     
  188.   #define VolumeParam struct __VP
  189.   
  190.   // parameters for control (CC) and status (SC) calls
  191.   // maximum variant size is 22 bytes
  192.     
  193.   union __OP
  194.     { 
  195.     // maximum variant size 
  196.     char filler[22];
  197.     
  198.     //for sound generator
  199.     short    sndVal;
  200.     
  201.     //for asynchronous driver
  202.     short    asncConfig;        // CC=8, stopbits, etc.  
  203.     struct
  204.       {            // CC=9 
  205.       Ptr    asncBPtr;    // new input buffer 
  206.       short    asncBLen;    // buffer length 
  207.       } asyncInBuff;
  208.     struct
  209.       {            // CC=10 
  210.       char    fXOn;        // XON flow ctl enabled 
  211.       char    fCTS;        // CTS flow ctl enabled 
  212.       char    xon;        // xon char 
  213.       char    xoff;        // xoff char 
  214.       char    errs;        // errors mask 
  215.       char    evts;        // event mask 
  216.       char    fInX;        // input xon enabled 
  217.       char    filler4;    
  218.       } asyncShk;
  219.     long    asyncNBytes;        // SC=2, # buffered bytes 
  220.     struct
  221.       {            // SC=8, status info 
  222.       char    cumerrs;    // cum errors 
  223.       char    XOffSend;    // xoff has been sent 
  224.       char    rdpend;        // read pending 
  225.       char    wrpend;        // write pending 
  226.       char    CTSHold;    // CTS flow hold 
  227.       char    XOFFHold;    // Xoff flow hold 
  228.       } ASStaRec;
  229.     
  230.     //for printer driver 
  231.     struct
  232.       {            // CC=4, printing bitmap 
  233.       long    param1;        // pnts to quickdraw bitmap 
  234.       long    param2;        // pnts to rect within bitmap 
  235.       long    param3;        // 0 for screen printing 
  236.       } printer;
  237.     // CC=5 writing raw to printer
  238.     // pointer to a byte string
  239.     // count of bytes
  240.     // pointer to an idle proc (or NIL)
  241.     // CC=6 special BitMap cases
  242.     // screen or top folder code
  243.     
  244.     // for font manager 
  245.     struct
  246.       {            // CC=8, tail hook 
  247.       Ptr    fontRecPtr;    // font mgr input record 
  248.       short    fontCurDev;    // current device 
  249.       } fontMgr;
  250.     
  251.     // for io driver/desk accessory 
  252.       Ptr event;        // pointer to EventRecord 
  253.     }; // end union of control status params 
  254.   
  255.   #define OpParamType union __OP
  256.   
  257.   struct __CP
  258.     {        // control and status parameter block 
  259.     struct __CP *ioLink;
  260.     short    ioType;
  261.     short    ioTrap;
  262.     Ptr        ioCmdAddr;
  263.     ProcPtr    ioCompletion;
  264.     short    ioResult;
  265.     char    *ioNamePtr;
  266.     short    ioVRefNum;
  267.     short    ioRefNum;
  268.     short    CSCode;
  269.     OpParamType csp;
  270.     };
  271.   
  272.   #define CntrlParam struct __CP
  273.   
  274. #endif
  275.